package com.lx.oms.controller.manager.impl;

import java.math.BigInteger;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.lx.oms.common.entity.Page;
import com.lx.oms.common.entity.Query;
import com.lx.oms.common.utils.Utils;
import com.lx.oms.controller.dao.JoinMapper;
import com.lx.oms.controller.entity.JoinEntity;
import com.lx.oms.controller.manager.JoinManager;

/**
 * 加盟申请
 *
 * @author houzhong
 * @date 2018年11月15日 下午3:42:52
 */
@Component("joinManager")
public class JoinManagerImpl implements JoinManager {

	@Autowired
	private JoinMapper joinMapper;

	@Override
	public List<JoinEntity> listJoin(Page<JoinEntity> page, Query search) {
		return joinMapper.listForPage(page, search);
	}

	@Override
	public int saveJoin(JoinEntity join) {
		if (join.getId() == null) {
			join.setId(Utils.id().toString());
		}
		return joinMapper.save(join);
	}

	@Override
	public JoinEntity getJoinById(BigInteger id) {
		JoinEntity tJoin = joinMapper.getObjectById(id);
		return tJoin;
	}

	@Override
	public int updateJoin(JoinEntity join) {
		return joinMapper.update(join);
	}

	@Override
	public int batchRemove(String[] id) {
		int count = joinMapper.batchRemove(id);
		return count;
	}
	
}
